In a machine tool having a tool magazine and tool changer, the operation for changing a tool between a spindle of the machine tool and the tool magazine is automatically performed by a command from a machining program. On the other hand, the preparatory work for a tool, that is, the operation of loading a tool into the tool magazine, is performed by an operator. The tool magazine is usually protected by being held in a housing, so when an operator loads a tool into the tool magazine, he opens the door of an opening part provided in the housing. To secure the safety of the operator, an interlock acts to prevent the tool magazine from operating when the door of the housing is opened and to prevent the door of the housing from being opened when the tool magazine is operating (for example, see PTL 1).